package org.springblade.dev.support;

import com.baomidou.mybatisplus.generator.config.querys.MySqlQuery;
import org.springblade.dev.constant.DevelopConstant;

/**
 * 保留版权 : CopyRright (c) 因联科技
 * 文件名称 : CusMySqlQuery.java
 * 文件编号 : 1-1-1
 * 功能描述 :
 * 文件版本 : 2021.07.08.01
 * 创建人名 : 于继业
 * 创建日期 : 2021-07-08
 * 修改人名 :
 * 修改日期 :
 *
 * @author 于继业
 */
public class CusMySqlQuery extends MySqlQuery {
	@Override
	public String[] fieldCustom() {
		return new String[]{
			"Field",
			"Type",
			"Collation",
			"Null",
			"Key",
			"Default",
			"Extra",
			"Privileges",
			"Comment",
			"db_data_type",
			"char_max_len",
			"numeric_precision",
			"numeric_scale"
		};
	}

	@Override
	public String tableFieldsSql() {
		String sss = "select COLUMN_NAME    as `Field`,\n" +
			"       COLUMN_TYPE    as `Type`,\n" +
			"       COLLATION_NAME as `Collation`,\n" +
			"       IS_NULLABLE    as `Null`,\n" +
			"       COLUMN_KEY     as `Key`,\n" +
			"       COLUMN_DEFAULT as `Default`,\n" +
			"       EXTRA          as 'Extra',\n" +
			"       PRIVILEGES     as `Privileges`,\n" +
			"       COLUMN_COMMENT as `Comment`,\n" +
			"       DATA_TYPE as `db_data_type`,\n" +
			"       CHARACTER_MAXIMUM_LENGTH as `char_max_len`,\n" +
			"       NUMERIC_PRECISION as `numeric_precision`,\n" +
			"       NUMERIC_SCALE as `numeric_scale`\n" +
			"from information_schema.columns\n" +
			"where table_name = '%s' \n";
		System.out.println(sss);
		return sss;
	}
}
